#define  _CRT_SECURE_NO_WARNINGS


#include<stdio.h>
#include<string.h>

int main()
{
	int x = 0, y = 0, ji = 0, tu = 0, temp = 0;
	scanf("%d %d", &x, &y);
	temp = y - (2 * x);
	if (temp / 2 == x)
		printf("0 %d\n", temp / 2);
	else if (x * 2 == y)
		printf("%d 0\n", x);
	else
		printf("%d %d\n", temp / 2, x - temp / 2);
	return 0;
}